package com.fractalist.man.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;

import com.fractalist.man.base.BaseServiceImpl;
import com.fractalist.man.base.ServiceAnnotation;
import com.fractalist.man.constants.ManConstants;
import com.fractalist.man.dao.IArticleColumnDao;
import com.fractalist.man.service.IArticleColumnService;

@Service
@ServiceAnnotation(classNames = IArticleColumnDao.class)
public class ArticleColumnService extends BaseServiceImpl implements
		IArticleColumnService {

	@Override
	public void resetConstantsMap() {
		List<Map<String, Object>> columnList = queryList("select * from "
				+ getTableName() + "");
		if (columnList.size() > 0) {
			ManConstants.ARTICLE_TYPE_MAP = new HashMap<Integer, String>();
			for (Map<String, Object> column : columnList) {
				ManConstants.ARTICLE_TYPE_MAP.put(
						Integer.valueOf(column.get("id") + ""),
						column.get("columnName") + "");

			}
		}

	}
}
